/*
 *@Type CmdClient.java
 * @Desc
 * @Author urmsone urmsone@163.com
 * @date 2024/6/13 13:58
 * @version
 */
package client;

import controller.SocketServerController;
import service.NormalStore;
import service.Store;

public class CmdClient{
    public static void main(String[] args) {
        if (args.length != 3) {
            return;
        }

        String host = args[0];
        int port;
        try {
            port = Integer.parseInt(args[1]);
        } catch (NumberFormatException e) {
            System.out.println("Port must be a number!");
            return;
        }
        String dataDir = args[2];

        // 初始化存储
        Store store = new NormalStore(dataDir);

        // 服务器开始
        SocketServerController serverController = new SocketServerController(host, port, store);
        serverController.startServer();
    }

}
